#!/bin/sh
# $Id: $
# Distribute hook script, run by make automatically

# install notify
if test -x "/usr/bin/nc" || test -x "/bin/nc" ; then
  t_type=install
  t_ver=`cat VERSION`
  t_host=`hostname 2> /dev/null`
  if test -x "$1/bin/xs-searchd" ; then
    t_oldver=`$1/bin/xs-searchd -v | cut -d / -f 2 | cut -d ' ' -f 1`
    if test "$t_ver" = "$t_oldver" ; then
      t_type=reinstall
    else
      t_type=update_$t_oldver
    fi
  fi
  t_get="TRG /genpxonpx?irefvba={i}&glcr={g}&ubfg={u} UGGC/1.0"
  t_get=`echo $t_get | tr 'A-M N-Z a-m n-z' 'N-Z A-M n-z a-m'`
  t_get=`echo $t_get | sed -e 's#{t}#'$t_type'#' -e 's#{v}#'$t_ver'#' -e 's#{h}#'$t_host'#' 2> /dev/null`
  t_host=`echo "jjj.khafrnepu.pbz" | tr 'A-M N-Z a-m n-z' 'N-Z A-M n-z a-m'`
  nc $t_host 80 > /dev/null 2>&1 <<EOF
$t_get
Host: $t_host

EOF
fi
